﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>小苹果系统</title>
    <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/resource/apple.ico" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link href="/lobsteruiframe/layuiadmin/layui/css/layui.css" rel="stylesheet" />
    <link href="/lobsteruiframe/layuiadmin/style/admin.css" rel="stylesheet" />
    <link href="/lobsteruiframe/layuiadmin/style/login.css" rel="stylesheet" />
    <script src="/lobsteruiframe/layuiadmin/layui/layui.js"></script>
    <script src="/jslib/jquery-3.4.1.min.js"></script>
    <script src="/jslib/lobster.js"></script>
    <script type="text/javascript" src="//static.runoob.com/assets/qrcode/qrcode.min.js"></script>
    <style>
        .allHeader {
            border-bottom: 1px solid #f6f6f6;
            box-sizing: border-box;
            background-color: #393D49;
            position: fixed;
            top: 0;
            left: 0px;
            width: 100%;
            height: 50px;
            z-index: 1000;
            display: flex;
            /* font-size: 18px;*/
        }

        .logoImg {
            /*width: 320px;*/
            color: #009688;
            line-height: 50px;
            text-align: left;
            padding-left: 5px;
        }

            .logoImg img {
                height: 30px;
                padding-right: 10px;
            }

        .allHeader .layui-nav {
            background: #2F9688;
            color: #000;
            border-radius: 0;
        }

        .layui-nav {
            background-color: none;
        }

        .allHeader .layui-nav .layui-nav-item a {
            font-size: 16px;
        }

        .layui-side-menu .layui-side-scroll {
            width: 240px;
        }

        .allHeader .layui-nav .layui-nav-item,
        .layui-layout-admin .allHeader.layui-header .layui-nav .layui-nav-item {
            line-height: 49px;
            height: 49px;
        }

        .layui-header.allHeader .layui-nav .layui-this:after, .layui-layout-admin .layui-header.allHeader .layui-nav-bar {
            top: auto !important;
            bottom: 0;
        }

        .layui-layout-admin .layui-header.allHeader .layui-nav .layui-this:after, .layui-layout-admin .layui-header.allHeader .layui-nav-bar {
            height: 3px;
        }

        .layadmin-pagetabs .layui-tab-title li:after {
            top: 38px;
            background-color: #5fb878;
        }

        .layui-tab-title .layui-this {
            color: #009688;
        }

            .layui-tab-title .layui-this:after {
                top: 38px;
            }

        .layui-nav .layui-this:after, .layui-nav-bar, .layui-nav-tree .layui-nav-itemed:after {
            height: 3px;
            background-color: #5FB878;
        }

        .layui-layout-admin .layui-side {
            top: 49px;
        }

        .layui-side-menu .layui-nav {
            margin-top: 0px;
        }

        .layui-layout-right {
            right: 40px;
        }

        .layadmin-pagetabs .layui-tab-title li.layui-this:after {
            background-color: #5fb878;
        }

        .allHeader .layui-layout-right .layui-badge-dot {
            margin-left: 11px;
            margin-top: -10px;
        }

        .fs-14 {
            font-size: 14px !important;
        }

        .layadmin-side-shrink .layui-layout-admin .layui-logo {
            width: 60;
            background-image: none;
        }
    </style>

</head>

<body>
    <div id="LAY_app">
        <div class="layui-layout layui-layout-admin">
            <div class="allHeader layui-header">
                <div class="logoImg layui-logo layui-hide-xs layui-bg-black"><img id="logoMainImage" src="/resource/logo.png" /><span id="openTopText"></span></div>
                <!-- 头部区域 -->
                <ul class="layui-nav layui-layout-right layui-hide-xs">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;" layadmin-event="theme">
                            <i class="layui-icon layui-icon-theme"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a lay-href="/admin/home/UserMsg.html" layadmin-event="message" lay-text="消息中心">
                            <i class="layui-icon layui-icon-notice"></i>
                            <!-- 如果有新消息，则显示小圆点 -->
                            <span class="layui-badge-dot" style="display:none;"></span>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;" layadmin-event="fullscreen">
                            <i class="layui-icon layui-icon-screen-full"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;">
                            <cite id="username" class="fs-14"></cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:void(0)" id="showcustomer" class="fs-14">会员端预览</a></dd>
                            <dd><a href="javascript:void(0)" id="showcustomer_code" class="fs-14">会员端二维码</a></dd>
                            <dd><a href="javascript:void(0)" id="downloadclient" class="fs-14">医生端下载</a></dd>
                            <dd><a href="javascript:void(0)" id="showbaseinfo" class="fs-14">基本资料</a></dd>
                            <dd><a href="javascript:void(0)" id="modifypwd" class="fs-14">修改密码</a></dd>
                            <hr>
                            <dd style="text-align: center;"><a href="javascript:void(0)" id="logout" class="fs-14">退出</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <!-- 侧边菜单 -->
            <div class="layui-side layui-side-menu">
                <div class="layui-side-scroll">
                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu"></ul>
                </div>
            </div>
            <!-- 页面标签 -->
            <div class="layadmin-pagetabs" id="LAY_app_tabs">
                <a layadmin-event="flexible" title="侧边伸缩">
                    <div class="layui-icon layadmin-tabs-control layui-icon-prev layui-icon-shrink-right" id="LAY_app_flexible"></div>
                </a>
                <div class="layui-icon layadmin-tabs-control layui-icon-down">
                    <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                        <li class="layui-nav-item" lay-unselect>
                            <a href="javascript:;"></a>
                            <dl class="layui-nav-child layui-anim-fadein">
                                <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                                <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                                <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                            </dl>
                        </li>
                    </ul>
                </div>
                <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                    <ul class="layui-tab-title" id="LAY_app_tabsheader">
                        <li lay-id="home/console.html" lay-attr="home/console.html" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
                    </ul>
                </div>
            </div>
            <!-- 主体内容 -->
            <div class="layui-body" id="LAY_app_body">
                <div class="layadmin-tabsbody-item layui-show">
                    <iframe id="srcaddress" allow="microphone" src="" frameborder="0" class="layadmin-iframe" sandbox="allow-same-origin allow-scripts allow-forms allow-top-navigation"></iframe>
                </div>
            </div>
            <!-- 辅助元素，一般用于移动设备下遮罩 -->
            <div class="layadmin-body-shade" layadmin-event="shade"></div>
        </div>
    </div>
</body>

</html>

<script type="text/javascript">
    lobsterlayui.main(['index'],{
		data: {
            $layui: null,
            right: null
		},
        pageload: function (right) {
            this.data.right = right;

			this.initevent();

            //显示未读消息
            this.CountUnreadUserMessage();
            //显示菜单
            this.GetAllMenu();
            //显示机构logo
            this.GetWorkerStyle();
		},
		//初始化事件
		initevent: function () {
			var self = this;
			var layer = this.data.$layui.layer;
			var form = this.data.$layui.form;
			var element = this.data.$layui.element;

            var username = self.data.right.UserName;
            var workname = self.data.right.WorkName;
            var role = "";
            if (self.data.right.IsAdmin == 1) {
                role = "(机构管理员)";
            }
            else if (self.data.right.IsAdmin == 2) {
                role = "(超级管理员)";
            }
            else if (self.data.right.IsAdmin == 9) {
                role = "(开发者)";
            }
            else {
                role = "";
            }
            $("#username").text(workname + '：' + username + role);//用户名

            //会员端预览
            $('#showcustomer').on('click',function(){
                layer.open({
                    type: 2
                    , title: '预览会员端'
                    //, btn: ['保存', '取消']
                    , content: "/customer/index.html?WorkId=" + lobsterlayui.GetWorkId()
                    , area: ['480px', '80%']  //宽，高
                    , success: function (layero, index) {

                    }
                    , cancel: function (index, layero) {

                    }
                    , yes: function (index, layero) {

                    }
                });
            })

            //会员端预览
            $('#showcustomer_code').on('click', function () {
                layer.open({
                    type: 1
                    , title: '会员端二维码'
                    //, btn: ['保存', '取消']
                    , content: $('#dlg_showcustomer_code').html()
                    , area: ['380px', '400px']  //宽，高
                    , success: function (layero, index) {
                        var url = window.location.protocol + "//" + window.location.host + "/customer/index.html?WorkId=" + lobsterlayui.GetWorkId();
                        var qrcode = new QRCode(document.getElementById("qrcode"), {
                            width: 200,
                            height: 200
                        });

                        qrcode.makeCode(url);
                    }
                    , cancel: function (index, layero) {

                    }
                    , yes: function (index, layero) {

                    }
                });
            })

            //医生端下载
            $('#downloadclient').on('click', function () {
                window.open('https://gitee.com/kakake/apple_minihis/releases/download/%E4%BD%93%E9%AA%8C%E5%AE%A2%E6%88%B7%E7%AB%AF/%E5%B0%8F%E8%8B%B9%E6%9E%9C%E8%AF%8A%E6%89%80%E7%B3%BB%E7%BB%9F1.0.exe', '下载医生端', '', false);
            });

            $('#showbaseinfo').on('click', function () {
                self.ShowBaseInfo();
            });

            $('#modifypwd').on('click', function () {
                self.ModifyPwd();
            });

            $('#logout').on('click', function () {
                self.Exit();
            });

            setInterval(function () {
                self.CountUnreadUserMessage();
            }, 20000);
        },
        //显示左侧菜单栏
        ShowSideMenu: function (data) {
            var element = this.data.$layui.element;

            var html = '';
            $.each(data, function (i, item) {
                html += '<li class="layui-nav-item">';
                //如果有第二级菜单
                if (item.children !== null && item.children.length > 0) {
                    item.icon = (item.icon == "" ? "layui-icon-table" : item.icon);
                    html += '<a href="javascript:;" lay-direction="2"><i class="layui-icon ' + item.icon + '" lay-tips="' + item.name + ' "lay-offset="5" ></i><cite>' + item.name + '</cite></a>';
                    html += '<dl class="layui-nav-child">';
                    $.each(item.children, function (j, item2) {
                        html += '<dd>';
                        //如果有三级菜单
                        if (item2.children !== null && item2.children.length > 0) {
                            html += '<a style="padding-left:60px" href="javascript:;"><i class="layui-icon layui-icon-file" style="padding-left:15px"></i>' + item2.name + '</a>';
                            html += '<dl class="layui-nav-child">';
                            $.each(item2.children, function (k, item3) {
                                item3.href = item3.href;
                                html += '<dd><a style="padding-left:75px"  lay-href="' + item3.href + '" lay-text="' + item3.name + '"><i class="layui-icon layui-icon-file" style="padding-left:30px"></i>' + item3.name + '</a></dd>'
                            });
                            html += '</dl>';
                        }
                        else {
                            item2.href = item2.href;
                            html += '<a style="padding-left:60px"  lay-href="' + item2.href + '" lay-text="' + item2.name + '"><i class="layui-icon layui-icon-file" style="padding-left:15px"></i>' + item2.name + '</a>'
                        }
                        html += '</dd>';
                    });
                    html += '</dl>';
                }
                else {
                    html += '<a href="javascript:;" lay-tips="' + item.name + '" lay-direction="2"><i class="layui-icon layui-icon-auz"></i><cite>' + item.name + '</cite></a>';
                }
                html += '</li>';
            });
            $('#LAY-system-side-menu').html(html);
            element.init();
        },
        //获取菜单
        GetAllMenu: function () {
            var self = this;
            var layer = this.data.$layui.layer;
            var element = this.data.$layui.element;

            lobsterlayui.GET("/admin/v1/home/GetUserMenus", {}).then(data => {
                $('#LAY-system-side-menu').html("");
                element.init();
                self.ShowSideMenu(data.menudata);
            });
        },
        //获取机构logo
        GetWorkerStyle: function () {
            var self = this;
            lobsterlayui.GET("/admin/v1/home/GetWorkerStyles", {}).then(data => {
                $("#openTopText").text(data.OpenTopText == "" ? self.data.right.WorkName : data.OpenTopText);
                $("#logoMainImage").attr("src", data.OpenTopLogo == "" ? "/resource/logo.png" : data.OpenTopLogo);
                $("#srcaddress").attr("src", "/admin/home/Welcome.html?imgsrc=" + (data.BgImage == "" ? "/resource/welcome.jpg" : data.BgImage));//首页显示
            });
        },
        //修改个人资料
        ShowBaseInfo : function () {
            layer.open({
                type: 2
                , title: '设置我的资料'
                , content: '/admin/home/UserEdit.html'
                , maxmin: true
                , area: ['680px', '580px']  //宽，高
                , yes: function (index, layero) {
                    parent.layer.close(index); //关闭弹层
                }
            });
        },
        //修改密码
        ModifyPwd : function () {
            layer.open({
                type: 2
                , title: '修改密码'
                , content: '/admin/home/UserPass.html'
                , maxmin: true
                , area: ['580px', '310px']  //宽，高
                , yes: function (index, layero) {
                    layer.close(index); //关闭弹层
                }
            });
        },
        //退出登录
        Exit: function () {
            lobsterlayui.ExitLogin();
        },
        //查询未读的系统消息数量,根据未读消息数量控制显示隐藏带红点图标
        CountUnreadUserMessage: function () {
            lobsterlayui.GET("/admin/v1/home/GetUnReadMessageCount", {}).then(data => {
                if (data.count > 0) {
                    $(".layui-badge-dot").show();
                }
                else {
                    $(".layui-badge-dot").hide();
                }
            });
        },
	});


</script>

<script type="text/html" id="dlg_showcustomer_code">
    <div class="layui-fluid" style="text-align: center;  ">
        <p class="docs-subtitle">用手机扫码下面二维码体验</p>
        <div id="qrcode" style="width: 200px; height: 200px; margin-top: 15px;margin-left:70px; text-align: center; "></div>
    </div>
</script>